package com.security6.authorizedb.controller;

import com.security6.authorizedb.entity.User;
import com.security6.authorizedb.service.UserService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Author: wangzhen
 * @Date: 2024-08-15 15:26
 * @Version: v1.0.0
 * @Description: TODO
 **/
@RestController
@RequestMapping("/user")
public class UserController {

    @Resource
    public UserService userService;

    @GetMapping("/list")
    public List<User> getList(){
        return userService.list();
    }

    @PostMapping("/add")
    public void add(@RequestBody User user){
        userService.saveUserDetails(user);
    }

    @PostMapping("/update")
    public void update(@RequestBody User user){
        userService.updateUserDetails(user);
    }
}
